import*as e from"../helpers/helpers.js";import*as t from"../../lit-html/lit-html.js";const r=new CSSStyleSheet;r.replaceSync(':host{display:inline-flex}:host(.hidden){display:none}slot{display:inline-flex;box-sizing:border-box;height:14px;line-height:13px;padding:0 6px;font-size:8.5px;color:var(--override-adorner-text-color,var(--color-text-primary));background-color:var(--override-adorner-background-color,var(--color-background-elevation-1));border:1px solid var(--override-adorner-border-color,var(--color-details-hairline));border-radius:10px}:host(:focus) slot{border-color:var(--override-adorner-focus-border-color,var(--color-primary-old))}:host([aria-pressed="true"]) slot{color:var(--override-adorner-active-text-color,var(--color-background));background-color:var(--override-adorner-active-background-color,var(--color-primary-old));border:1px solid var(--override-adorner-active-background-color,var(--color-primary-old))}::slotted(*){height:10px}\n/*# sourceURL=adorner.css */\n');const{render:o,html:a}=t;class i extends HTMLElement{static litTagName=t.literal`devtools-adorner`;name="";#e=this.attachShadow({mode:"open"});#t=!1;#r;#o;#a;set data(e){this.name=e.name,e.content.slot="content",this.#a?.remove(),this.append(e.content),this.#a=e.content,this.#i()}connectedCallback(){this.getAttribute("aria-label")||this.setAttribute("aria-label",this.name),this.#e.adoptedStyleSheets=[r]}isActive(){return"true"===this.getAttribute("aria-pressed")}toggle(e){if(!this.#t)return;const t=void 0===e?!this.isActive():e;this.setAttribute("aria-pressed",Boolean(t).toString()),this.setAttribute("aria-label",(t?this.#o:this.#r)||this.name)}show(){this.classList.remove("hidden")}hide(){this.classList.add("hidden")}addInteraction(e,t){const{isToggle:r=!1,shouldPropagateOnKeydown:o=!1,ariaLabelDefault:a,ariaLabelActive:i}=t;this.#t=r,this.#r=a,this.#o=i,this.setAttribute("aria-label",a),r&&(this.addEventListener("click",(()=>{this.toggle()})),this.toggle(!1)),this.addEventListener("click",e),this.classList.add("clickable"),this.setAttribute("role","button"),this.tabIndex=0,this.addEventListener("keydown",(e=>{"Enter"!==e.code&&"Space"!==e.code||(this.click(),o||e.stopPropagation())}))}#i(){o(a` <slot name="content"></slot> `,this.#e,{host:this})}}e.CustomElements.defineComponent("devtools-adorner",i);var s=Object.freeze({__proto__:null,Adorner:i});export{s as Adorner};
